package libtool65.o65;

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;

public class ExportDefinitions {

	private ExportDefinition[] exports;

	public void read(InputStream file, Mode mode) throws IOException {
		int count = mode.readSize(file);
		exports = new ExportDefinition [count];
		for (int i = 0; i < count; i++)
		{
			exports[i] = new ExportDefinition();
			exports[i].read(file, mode);
		}
	}

	public void dumpInfo(PrintStream out) {
		for (ExportDefinition export : exports)
			export.dumpInfo(out);
	}

	public ExportDefinition[] toArray() {
		return exports;
	}

	public ExportDefinition getDefinition(String label) {
		for (int i = 0; i < exports.length; i++)
			if (exports[i].getName().equals(label))
				return exports[i];
		return null;
	}
}
